//
//  JLSAdViewController.m
//  看点
//
//  Created by 焦林生 on 15/12/15.
//  Copyright © 2015年 jiaolinsheng. All rights reserved.
//

#import "JLSAdViewController.h"
#import "JLSMainTabBarController.h"

@interface JLSAdViewController ()

@end

@implementation JLSAdViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    
    //1 设置背景图片
    UIImageView *backImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default"]];
    [self.view addSubview:backImage];
     backImage.frame = self.view.bounds;
    
    //2 设置广告图片
    UIImageView *adImage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ad"]];
    [self.view addSubview:adImage];
    
    adImage.width = 306;
    adImage.height = 310;
    adImage.centerX = self.view.width * 0.5;
    adImage.centerY = self.view.height * 0.4;
    
    //3 广告之后获取主窗口 跳转到 mainTabBarVC
    //GCD 延迟 2秒
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        
        //3.1 获取主窗口
        UIWindow *window = [UIApplication sharedApplication].keyWindow;
        
        //3.2 创建 UITabBarController
        JLSMainTabBarController *TabBarVC = [[JLSMainTabBarController alloc] init];
        
        //3.3 设置 window 的跟控制器为 tabBarVC
        window.rootViewController = TabBarVC;
        
        
    });
    
    
}



@end
